
setlocal enabledelayedexpansion
set myvar: 
for /d %%d In (*.*) DO set myvar=!myvar! "%%d"

collate2 %myvar% h,cpp,cs,java

pause